﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Kokomo.Environment.Documents
{
	/// <summary>
	/// Represents the viewmodel for viewing the details of an object.
	/// </summary>
	/// <remarks>
	/// The host UI contains a template that displays the <see cref="Summary"/>.
	/// The target <see cref="Content"/> must be marked with <see cref="Kokomo.Environment.ViewTypeAttribute"/>
	/// to specify a view template.
	/// </remarks>
	public class DetailViewModel : NotifierObject
	{
		/// <summary>
		/// The content to display.
		/// </summary>
		/// <remarks>
		/// The content object must be marked with <see cref="Kokomo.Environment.ViewTypeAttribute"/>
		/// to specify a view template.
		/// </remarks>
		public object Content { get; private set; }

		/// <summary>
		/// Initializes a new <see cref="DetailViewModel"/>.
		/// </summary>
		/// <param name="navigationContext">The <see cref="NavigationContext"/>.</param>
		/// <param name="content">The content to display.</param>
		/// <param name="heading">The heading of the view.</param>
		public DetailViewModel(
			NavigationContext navigationContext,
			object content,
			UiString heading
			)
		{
			if (navigationContext == null) throw new ArgumentNullException("navigationContext");

			this.NavigationContext = navigationContext;
			this.Content = content;

			this.Summary = new SummaryViewModel(heading);
		}

		/// <summary>
		/// Gets the <see cref="NavigationContext"/>.
		/// </summary>
		public NavigationContext NavigationContext { get; private set; }
		/// <summary>
		/// Gets the <see cref="SummaryViewModel"/> containing summary information.
		/// </summary>
		public SummaryViewModel Summary { get; private set; }
	}
}
